package team.se.tms.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * Http辅助工具类
 *
 * @author winkyle
 * @date 2018/11/27
 */
public class HttpUtil{

    /**
     * 获取HttpServletRequest对象
     *
     * @return 一个提供客户端请求信息的 {@link HttpServletRequest}
     * @create on 2018/11/6 by winkyle
     */
    public static HttpServletRequest getRequest() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return request;
    }
}
